﻿using DotNetStar.TheKing.Domain.Entities.Configuration;
using Microsoft.EntityFrameworkCore;

namespace DotNetStar.TheKing.Domain
{
    public class TheKingDbContext : DbContext
    {
        public TheKingDbContext(DbContextOptions<TheKingDbContext> options) : base(options)
        {
        }
        
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.ApplyConfiguration(new UserConfiguration())
                .ApplyConfiguration(new ContentConfiguration())
                .ApplyConfiguration(new TagConfiguration());

            modelBuilder.Entity<ContentInviteUser>();
            modelBuilder.Entity<ContentComment>().HasKey(m => m.Id);
            modelBuilder.Entity<PointsStrategy>().HasKey(m => m.Id);
            modelBuilder.Entity<Attachment>();
            modelBuilder.Entity<UserPointHistory>();
            modelBuilder.Entity<UserOperationHistory>();
            modelBuilder.Entity<UserContentPayHistory>();
            modelBuilder.Entity<UserSignIn>();
            modelBuilder.Entity<ContentTag>();
            modelBuilder.Entity<Category>();
        }
    }
}
